
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>教师管理-新增</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/lib//.min.css" media="all">
  </head>
  <body style="font-size: 0.9rem;" class="m-3">
    <div class="d-flex flex-column layui-form">
      <div class="d-flex mb-4">
        <div class="col d-flex">
          <label class="d-flex align-items-center" style="margin: 0px;width: 80px;">姓名:</label>
          <input id="teacherName" class="form-control form-control-sm" value="" placeholder="请输入教师姓名"/>
        </div>
        <div class="col d-flex">
          <label class="d-flex align-items-center" style="margin: 0px;width: 80px;">性别:</label>
          <input type="radio" name="sex" value="男" title="男"/>
          <input type="radio" name="sex" value="女" title="女"/>
        </div>
      </div>
      <div class="d-flex mb-4">
        <div class="col d-flex">
          <label class="d-flex align-items-center" style="margin: 0px;width: 80px;">电话:</label>
          <input id="phone" class="form-control form-control-sm" value="" placeholder="请输入电话"/>
        </div>
        <div class="col d-flex">
          <label class="d-flex align-items-center" style="margin: 0px;width: 80px;">编号:</label>
          <input id="teacherNum" class="form-control form-control-sm" value="" placeholder="请输入编号"/>
        </div>
      </div>
      <div class="d-flex mb-4">
        <div class="col d-flex align-items-center">
          <label class="d-flex align-items-center" style="margin: 0px;width: 80px;">密码:</label>
          <input id="password" class="form-control form-control-sm" value="" placeholder="请输入密码"/>
        </div>
        <div class="col d-flex align-items-center">
          <label class="d-flex align-items-center" style="margin: 0px;width: 80px;">简介:</label>
          <textarea id="teacherDesc" class="form-control form-control-sm" value="" placeholder="请输入编号"></textarea>
        </div>
      </div>
    </div>
    <script src="${pageContext.request.contextPath}/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/lay-config.js" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/http.js" charset="utf-8"></script>
    <script>
        var layer = null;
        layui.use(['layer'], function () {
            layer = layui.layer;
        })

        function addParms() {
            //获取姓名
            var teacherName = $("#teacherName").val();
            if (!teacherName) {
                layer.msg('请填写教师姓名');
                return;
            }
            //获取性别
            var sex = $("input[name='sex']:checked").val();
            if (!sex) {
                layer.msg('请选择性别');
                return;
            }
            //获取电话
            var phone = $("#phone").val();
            if (!phone) {
                layer.msg('请填写电话');
                return;
            }
            if(phone.length > 11){
                 layer.msg('电话位数不对!');
                return;
            }
            //获取编号
            var teacherNum = $("#teacherNum").val();
            if (!teacherNum) {
                layer.msg('请填写编号');
                return;
            }
            //获取密码
            var password = $("#password").val();
            if (!password) {
                layer.msg('请填写密码');
                return;
            }
            //获取简介
            var teacherDesc = $("#teacherDesc").val();
            if (!teacherDesc) {
                layer.msg('请填写简介');
                return;
            }
            return {
                teacherName: teacherName,
                sex: sex,
                phone: phone,
                teacherNum: teacherNum,
                password: password,
                teacherDesc: teacherDesc
            }
        }
    </script>
  </body>
</html>
